#ifndef VPGAME_H
#define VPGAME_H

#include "VPGameBase.h"
#include "shue.h"

class VPHand;
class VPConnection;
class VPokerSavedGame;
class VPGuts;
class GameDBInterface;
class VPokerSQL;

// kharmon.  03-22-06.  #10515.  Changed the base class.
// This class supports ALL of the 5 card video poker games. 
class VPGame : public VPGameBase
{
	public:
		VPGame(VPConnection* conn, GameDBInterface *pDBInterface);
		VPGame(VPConnection*, GameDBInterface *pDBInterface, VPokerSavedGame*);
		~VPGame();

		bool8 initOk();

		int32 deal();

		enum HoldResults
		{
			HOLD_SUCCESS_GAMEOVER,
			HOLD_SUCCESS_DBLUP_PENDING,
			HOLD_FAILURE
		};
		int32 holdThese(uint8 Cards);	// bits 0..5:  1 if held

		bool8 doubleUpDeny();
		bool8 doubleUpDeal();

		int32 doubleUpDraw(uint8 held);

		VPHand* getHand();

		int32 getPayFreq();
		bool8 getDoubleUpEnabled();

		void send();
		void save(VPokerSavedGame*);

        virtual bool8 handleMessage(unsigned char *pucMsgBuf, int32 nMsgLen);

	protected:
		bool8 restore(VPokerSavedGame*);

	protected:
		VPConnection*	conn;
        VPokerSQL*      m_pDBInterface; // kharmon.  03-22-06.  This is now our connection to the database.
		VPGuts*			guts;
		ShueGameInfo	sgi;
		Shue*			shue;
		VPHand*			hand;
		int32			bet;
		int32			state;
		int32			dblUpEnabled;
		int32			dblUpPayout;
		int32			dblUpPayType;
		int32			dblUpRound;
		int32			dblUpWon;
		int32			dlbUpCapAmount;
		int32			restoreOrigPayType;
		int32			restoreLastHeld;
		//
		// *IMPORTANT*  When adding/changing here, be sure to update
		//				constructors/destructor, send(), save(), restore()
		//
};



inline VPHand*
VPGame::getHand()
{
	return hand;
}

inline bool8
VPGame::getDoubleUpEnabled()
{
	return (bool8)(dblUpEnabled != 0);
}

#endif
